#include "bomberlib.hh"
#include "Object.hh"

namespace Object
{
  void Pyramide::initialize(void)
  {
  }
  void Pyramide::update(gdl::GameClock const & gameClock, gdl::Input & input)
  {
    if (input.isKeyDown(gdl::Keys::Right) == true)
      this->rotation_.y = ((int)rotation_.y + 1) % 360;
    if (input.isKeyDown(gdl::Keys::Left) == true)
      this->rotation_.y = ((int)rotation_.y - 1) % 360;

  }
  void Pyramide::draw(void)
  {
    glPushMatrix();
    glLoadIdentity();
    glTranslatef(0.0f, 0.0f, -900.0f);

    glRotatef(this->rotation_.y, 0.0f, 1.0f, 0.0f);

    glBegin(GL_TRIANGLES);

    glColor3f(1.0f, 1.0f, 1.0f);
    /// Vertex haut : B
    glVertex3f(0.0f, -150.0f, -150.0f);
    /// Vertex inferieur gauche : C
    glVertex3f(-150.0f, -150.0f, 150.0f);
    /// Vertex inferieur droit : D
    glVertex3f(150.0f, -150.0f, 150.0f);
    glColor3f(1.0f, 0.0f, 0.0f);
    /// Vertex haut : A
    glVertex3f(0.0f, 150.0f, 0.0f);
    /// Vertex inferieur gauche : C
    glVertex3f(-150.0f, -150.0f, 150.0f);
    /// Vertex inferieur droit : D
    glVertex3f(150.0f, -150.0f, 150.0f);
    glColor3f(0.0f, 1.0f, 0.0f);
    /// Vertex haut : A
    glVertex3f(0.0f, 150.0f, 0.0f);
    /// Vertex inferieur gauche : B
    glVertex3f(0.0f, -150.0f, -150.0f);
    /// Vertex inferieur droit : C
    glVertex3f(-150.0f, -150.0f, 150.0f);
    glColor3f(0.0f, 0.0f, 1.0f);
    /// Vertex haut : A
    glVertex3f(0.0f, 150.0f, 0.0f);
    /// Vertex inferieur gauche : D
    glVertex3f(150.0f, -150.0f, 150.0f);
    /// Vertex inferieur droit : B
    glVertex3f(0.0f, -150.0f, -150.0f);

    glEnd();
    glPopMatrix();
  }
}
